package com.redis1.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;
import java.util.concurrent.TimeUnit;

/**
 * @author: LI-CI-GAO
 * 作者: licigao
 * 日期: 2021/8/27  19:20
 * 描述:
 */

@RestController
public class TestMidengJiaoYan {


    @Autowired(required = false)
    private RedisTemplate<String,Object> redisTemplate;

    @RequestMapping("getKey")
    public String getKey(){

        String string = UUID.randomUUID().toString();

        redisTemplate.opsForValue().set(string,string,24,TimeUnit.HOURS);

        return  string;
    }





}
